#include<stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>

/*
1.open file , get handler
2. read one line to line
 */

FILE* input_files;

char *line;
int length = 128;
char *cptr;

void open_files();
void get_line();
void reader();

int alpha_number(char c);
int is_number(char c);

void Release();


int main() 
{
  line = (char *)malloc(sizeof(char)*length);
  memset(line,0,sizeof(char)*length);
  
  open_files();

  reader();

  Release();
  
  return 0; 
}

int alpha_number(char c)
{
  if((c >= 'a' && c <= 'z')
     || (c >= 'A' && c <= 'Z')
     || (c >= '0' && c <= '9')
     || c == '_')
    {
      return 0;
    }
#if LISP
  if(c != ' '
     || c != '\n'
     || c != '\t'
     )
    return 0;
#endif
  return 1;
}

int is_number(char c)
{
  if(c >= '0' && c <= '9')
    return 0;
  return 1;
}

void open_files()
{
  input_files = fopen("in.txt","r");
  if(input_files == NULL) 
    {
      printf("open in.txt fail!!!\n");
      exit(1);
    }
}

void reader()
{
  get_line();
}

void get_line()
{
  char c;
  int index = 0;
  FILE *f = input_files; 
  while((c =getc(f)) != EOF)
    {
      line[index++] = c;
      if(c == '\n') 
        {
          cptr = line;
          return;
        }        
      if(index>length)
        {
          length += 128;
          line = (char *)realloc(line,length);
        }
    }
}

void Release()
{
	if(input_files!=NULL)
	fclose(input_files);
	if(line!=NULL)
	free(line);
}
